/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-07-06 16:56:18
 * @LastEditTime : 2023-07-06 17:01:14
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\ProjectBuildListChild.jsx
 * @Description  :
 */

import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { CommonButton } from '../Common/options'
import { OrganizationIdentityLevel } from '../Common/Conversion'

export const ProjectBuildListChild = async ({ url, OptionsEvent, Permission }) => {
    let data = {
        type: '建设程序',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST([5])[`getOrganizationIdentityLevel`],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'selfOrganizationUuid',
                title: '组织机构',
                valueType: 'select',
                valueEnum: await OrganizationIdentityLevel(5),
                width: 300,
                hideInAdded: true,
                hideInModify: true,
                hideInTable: true,
            },
            { ...commonTableList.tableName, title: '项目名称', width: 500, hideInSearch: true },
            { ...commonTableList.code, rules: true },
            { ...commonTableList.sortId, rules: true },
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    // const { uuid } = record
                    return [
                        <CommonButton
                            key="RichText"
                            OptionsEvent={OptionsEvent}
                            title="附件管理"
                            data={{
                                smallTitle: `建设程序附件详情`,
                                type: 'BaDaFilingCabinet',
                                record,
                                width: 1500,
                                Permission,
                                dataType: 1,
                            }}
                        />,
                        <CommonButton
                            key="two"
                            OptionsEvent={OptionsEvent}
                            title="文件配置"
                            data={{
                                smallTitle: `建设程序文件配置`,
                                type: 'BaDaFilingCabinetConfiguration',
                                record,
                                width: 1500,
                                dataType: 1,
                            }}
                        />,
                        // <TwoModalBtn
                        //     key="TwoModalTwo"
                        //     towKey="ProjectBuildListChild"
                        //     OptionsEvent={OptionsEvent}
                        //     data={record}
                        //     Permission={Permission}
                        //     title="建设程序附件"
                        // />,
                        // Permission.findIndex(v => v.uuid === 'f209b2a9-c3ad-4eb6-9bd9-4df1f1ce9c3a') !== -1 && (
                        //     <OtherBtn
                        //         key="more"
                        //         OptionsEvent={OptionsEvent}
                        //         record={record}
                        //         pageHeaderData={data.columns}
                        //         menus={[
                        //             {
                        //                 key: 'ProjectBuildListModal',
                        //                 name: '建设程序文件配置',
                        //                 list: [
                        //                     'getBuildListTree',
                        //                     'getOrganizationBuildList',
                        //                     'posOrganizationBuildListBatch',
                        //                     'buildListUuid',
                        //                 ],
                        //             },
                        //         ]}
                        //     />
                        // ),
                    ]
                },
            },
        ],
    }
    return data
}
